package com.demo.exce;

/**
 * @Author WaveHi
 * @Date 26/7/2021 上午 11:04
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description
 */
public class WhileDemo4 {

    public static void main(String[] args) {

        //定义变量total存储求和结果
        int total = 0;

        //定义循环控制变量
        int count = 1;

        //循环求和
        while(count <= 10){
            //判断是否为偶数
            if(count % 2 == 0){
                total += count;
            }
            count++;
        }
        System.out.println("total = " + total);

    }

}
